package common;

import javax.swing.table.AbstractTableModel;

public class MyTableModel extends AbstractTableModel 
{
    private String[] columnNames = {"Message",
    								"FileName",
    								"Params",
                                    "Version",
                                    "Author",
                                    "Status"};
    private Object[][] data;

    public MyTableModel()
    {
    	super();
    }
    
    public MyTableModel(Object[][] fileList)
    {
    	super();
    	data = fileList;
    }
    
    public void setData(Object[][] fileList){
    	data = fileList;
    }
    
    public int getColumnCount() {
        return columnNames.length;
    }

    public int getRowCount() {
        return data.length;
    }

    public String getColumnName(int col) {
        return columnNames[col];
    }

    public Object getValueAt(int row, int col) {
        return data[row][col];
    }

    /*
     * JTable uses this method to determine the default renderer/
     * editor for each cell.  If we didn't implement this method,
     * then the last column would contain text ("true"/"false"),
     * rather than a check box.
     */
    public Class getColumnClass(int c) {
        return getValueAt(0, c).getClass();
    }
}